package com.anne.fish.webapp.formbean;

import org.apache.commons.lang.StringUtils;

public class InfoSearch extends Pageine{

	public InfoSearch() {
		super();
	}

	public static final String DEFAULT_VALUE_ALL = "-1";
	
	public static final Integer DEFAULT_VALUE_ALL_INT = -1;
	
	private Integer catId ;
	
	 
	private Integer areaId;
	
	private String prices;
	
	private Integer lowPrice;
	
	private Integer highPrice;
	
	private Integer sell;
	private String searchWord;
	
	
	private Long uid;
	
	/**
	 * 1 有  0 无 -1 全部
	 */
	private Integer pic;
	
	
	
	
	public Integer getPic() {
		return pic;
	}

	public void setPic(Integer pic) {
		this.pic = pic;
	}

	public Long getUid() {
		return uid;
	}

	public void setUid(Long uid) {
		this.uid = uid;
	}

	public String getSearchWord() {
		return searchWord;
	}

	public void setSearchWord(String searchWord) {
		this.searchWord = searchWord;
	}

	/**
	 * 0  买
	 * 1  卖
	 * 2  全部
	 * @return
	 */
	public Integer getSell() {
		if(sell ==null ){
			sell = DEFAULT_VALUE_ALL_INT;
		}
		return sell;
	}

	public void setSell(Integer sell) {
		this.sell = sell;
	}

	

	public Integer getCatId() {
		return catId;
	}

	public void setCatId(Integer catId) {
		this.catId = catId;
	}

	public Integer getAreaId() {
		return areaId;
	}

	public void setAreaId(Integer areaId) {
		this.areaId = areaId;
	}

	public boolean isPriceAll(){
		if(prices == null || DEFAULT_VALUE_ALL.equals(prices)){
			return true;
		}
		
		return false;
	}
	
	public String getPrices() {
		if(prices == null){
			return DEFAULT_VALUE_ALL;
		}
		return prices;
	}

	/**
	 * -1表示全部  list.jsp 页面传进来
	 * @param prices
	 */
	public void setPrices(String prices) {
		
				
		this.prices = prices;
		if(!StringUtils.isBlank(prices)&&!isPriceAll()){
			String[] moneys = prices.split("_");
			this.lowPrice = Integer.valueOf(moneys[0]);
			this.highPrice = Integer.valueOf(moneys[1]);
		}
	}

	public Integer getLowPrice() {
		return lowPrice;
	}

	public void setLowPrice(Integer lowPrice) {
		this.lowPrice = lowPrice;
	}

	public Integer getHighPrice() {
		return highPrice;
	}

	public void setHighPrice(Integer highPrice) {
		this.highPrice = highPrice;
	}

 

 
}
